package org.serv;


public class Article {
	
	private String nom;
	private String description;
	private float prix;
	private String pathPhoto;
	private int stock;
	private int identifiant;
	private static int cpt;
	
	public Article () {}
	
	public Article (String pathPhoto, String nom, String description, float prix, int stock)
	{
		this();
		this.pathPhoto = pathPhoto;
		this.nom = nom;
		this.description = description;
		this.prix = prix;
		this.stock = stock;
		this.identifiant = ++cpt;
	}
	
	public Article getById (int id)
	{
		if (id == identifiant) return this;
		return null;
	}
	
	public int getId ()
	{
		return identifiant;
	}
	
	public float getPrix ()
	{
		return prix;
	}
	
	public void ajoutStock (int plus)
	{
		stock += plus;
	}
	
	public void removeStock (int moins)
	{
		stock -= moins;
	}
	
	public String toString ()
	{
		return "<br><img height='200' width='200' src='" + pathPhoto + "'><br><br>"
				+ nom + "<br><br>"
				+ description + "<br>"
				+ prix + " €<br>"
				+ stock + " en stock<br>";
	}
}
